package com.example.administrator.biyesheji_print.Utils;

import android.content.Context;

/**
 * Created by Administrator on 2018/3/29.
 */

public class SharedPreferencesUtils {
    public static final String NAME="SP";
    public static void putStringValue(Context context,String key,String value){
        context.getSharedPreferences(NAME,Context.MODE_PRIVATE).edit().putString(key,value).commit();
    }
    public static String getStringValue(Context context, String key, String defvalue){
        return context.getSharedPreferences(NAME,Context.MODE_PRIVATE).getString(key,defvalue);
    }
    public static void putBoolean(Context context,String key,boolean value){
        context.getSharedPreferences(NAME,Context.MODE_PRIVATE).edit().putBoolean(key,value).commit();
    }
    public static boolean  getBoolean(Context context,String key,boolean def){
        return context.getSharedPreferences(NAME,Context.MODE_PRIVATE).getBoolean(key,def);
    }
    public static void putInt(Context context,String key,int value){
        context.getSharedPreferences(NAME,Context.MODE_PRIVATE).edit().putInt(key,value).commit();
    }
    public static int getInt(Context context,String key,int defvalue){
        return context.getSharedPreferences(NAME,Context.MODE_PRIVATE).getInt(key,defvalue);
    }
}
